﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GMap.NET;
using GMap.NET.WindowsForms;
using GMap.NET.MapProviders;

namespace TimKiemDiaDiem
{
    public partial class LoadingForm : Form
    {
        public LoadingForm()
        {
            InitializeComponent();
        }
        public int Invetval
        {
            get { return timer.Interval; }
            set { timer.Interval = value; }
        }
        private string[] loadingString = {"",".","..","..."};
        private int curLoadingString=0;
        private void timer_Tick(object sender, EventArgs e)
        {
            curLoadingString = (curLoadingString + 1) % 4;
            loadingLabel.Text = "Loading" + loadingString[curLoadingString];           
        }

        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            (this.Owner as MainForm).MapForm.MainMap.MapProvider = GMapProviders.GoogleMap;            
        }

        private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            timer.Stop();
            this.Close();
        }

        private void LoadingForm_Load(object sender, EventArgs e)
        {
            timer.Start();
            worker.RunWorkerAsync();
        }
    }
}
